package com.zdsoft.blp.gongyong.application;

import android.app.Application;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;

import com.squareup.picasso.Picasso;
import com.zdsoft.blp.R;
import com.zdsoft.blp.gongyong.imageTrans.CircleImage;

import org.xutils.x;

/**
 * Created by pc on 2016/9/5.
 */
public class MyApp extends Application {
    public static Picasso  picasso;
    @Override
    public void onCreate() {
        super.onCreate();
        picasso = Picasso.with(getApplicationContext());
        x.Ext.init(this);
    }
    public static void setImage(String imageUrl, ImageView iv){
        if(imageUrl==""||imageUrl==null){
            picasso.load(R.drawable.no_pic).into(iv);
        }else {
            picasso.load(imageUrl).error(R.drawable.no_pic).placeholder(R.drawable.loading).into(iv);
        }

    }
    public static void setImage(String imageUrl, ImageView iv,boolean isRound){
        if(imageUrl==""||imageUrl==null){
            picasso.load(R.drawable.no_pic).into(iv);
        }else {
            picasso.load(imageUrl).error(R.drawable.no_pic).placeholder(R.drawable.loading).transform(new CircleImage()).into(iv);
        }
    }
}
